package contegor.scire.core;


/**
 * {@link Task} used to notify a {@link Container} that it must track external {@link Link}s that
 * points out one of its {@link Identifiable}.
 *
 * @version $Revision: 1.2 $
 * @author  Héctor Cirbián Pousa ($Author: hector $)
 */
@Version("$Id: TrackExternalLink.java,v 1.2 2010-02-01 10:55:41 hector Exp $")
public class TrackExternalLinks extends TaskImpl<Void> {
  private static final long serialVersionUID = -914794960395853518L;

  private IdFragment target;
  private Id         externalContainerId;
  private int        amount;

  public TrackExternalLinks(TaskId taskId, Id targetContainerId, IdFragment target, Id externalContainerId) {
    super(taskId, targetContainerId);
    this.target              = target;
    this.externalContainerId = externalContainerId;
    this.amount              = 1;
  }

  public TrackExternalLinks(TaskId taskId, Id targetContainerId, IdFragment target, Id externalContainerId, int amount) {
    super(taskId, targetContainerId);
    this.target              = target;
    this.externalContainerId = externalContainerId;
    this.amount              = amount;
  }

  public TrackExternalLinks(Id targetContainerId, IdFragment target, Id externalContainerId) {
    super(targetContainerId);
    this.target              = target;
    this.externalContainerId = externalContainerId;
    this.amount              = 1;
  }

  public TrackExternalLinks(Id targetContainerId, IdFragment target, Id externalContainerId, int amount) {
    super(targetContainerId);
    this.target              = target;
    this.externalContainerId = externalContainerId;
    this.amount              = amount;
  }

  public void process(Container container) throws MissingElementException {
    container.trackExternalLinks(target, externalContainerId, amount);
  }
}
